#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

namespace fastio{
    struct{template<typename T>operator T(){
        T x=0;char f=0,c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=1;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+(c^48);c=getchar();}
        return f?-x:x;
    }}in;int stk[40],tp;
    template<typename T>void out(T x,char c=0){
        if(x<0)putchar('-'),x=-x;
        do stk[++tp]=x%10,x/=10;while(x);
        while(tp)putchar(stk[tp--]^48);
        if(c)putchar(c);
    }
}using fastio::in;using fastio::out;

const int N = 200005;
int a[N],b[N];
int n,L;

namespace sub_1{
    int main(){
        int ans = 0;
        for(int k=1;k<(1<<n);k++){
            int A = 0,B = 0;
            for(int j=1;j<=n;j++)
                if((k>>(j-1))&1)
                    A ^= a[j],B ^= b[j];
            if(A<=L)
                ans = max(ans,B);
        }
        out(ans);
        return 0;
    }
}

namespace sub_2{
    const int M = 1050;
    bool vis[M][M];
    pair<int,int> f[M*M];
    int pos;

    int main(){
        sort(a+1,a+1+n);
        int mans = 0;
        for(int k=1;k<=n;k++)
            mans |= b[k];
        f[++pos] = {0,0};
        vis[0][0] = true;
        int ans = 0;
        for(int k=1;k<=n;k++){
            for(int j=1,i=pos;j<=i;j++){
                int A = a[k]^f[j].first,B = b[k]^f[j].second;
                if(!vis[A][B]){
                    f[++pos] = {A,B};
                    vis[A][B] = true;
                    if(A<=L)
                        ans = max(ans,B);
                    if(ans==mans)
                        break;
                }
            }
            if(ans==mans)
                break;
        }
        out(ans);
        return 0;
    }
}

int main(){
    freopen("lock.in","r",stdin);
    freopen("lock.out","w",stdout);
    n = in,L = in;
    int maxx = 0,mans = 0;
    for(int k=1;k<=n;k++){
        a[k] = in,b[k] = in;
        maxx = max({maxx,a[k],b[k]});
        mans |= b[k];
    }
    if(n<=18)
        return sub_1::main();
    if(maxx<1024)
        return sub_2::main();
    out(mans);
    return 0;
}